home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8413 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: isonews.bbn.hp.com!hpbblb!news
  2. From: Matthias Dittrich <matti>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Using multiple modules
  5. Date: 4 Mar 1996 09:20:10 GMT
  6. Organization: Hewlett-Packard Co.
  7. Message-ID: <4hecka$qf2@hpbblb.bbn.hp.com>
  8. References: <4h9led$b4g@news.doit.wisc.edu>
  9. NNTP-Posting-Host: trabant.bbn.hp.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.1N (X11; I; HP-UX A.09.07 9000/712)
  14. X-URL: news:4h9led$b4g@news.doit.wisc.edu
  15.  
  16. jdscott@students.wisc.edu (Jim Scott) wrote:
  17. >I'm trying to break up growing source code into multiple modules.  As 
  18. >per the FAQ, I've moved all my external definitions to a header file 
  19. >included in both the modules I'm working with.
  20. >
  21. >I can compile the source code into separate object files, but am unable 
  22. >to link.  I get one of two errors:
  23. >
  24. >"symbol defined more than once"  this is in reference to the only 
  25. >function in the second object file.  I've checked, and it is only 
  26. >defined in the header file.
  27. >
  28. >"unresolved externals"  and a reference to a ??main?? file.  No clue 
  29. >what's happening here.
  30. >
  31. >In the meantime, I'm simply working with the single source file.  Any 
  32. >help is greatly appreciated!
  33. >
  34. It seems you havn't set the compiler options correctly. Compile each file
  35. with option -c, that gives you a .o file as output. In a second step
  36. link all the .o files to the execuatable program.
  37.  
  38. Good luck,
  39. Matthias
  40.  
  41.